home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-07 | 3.4 KB | 88 lines | [TEXT/MPS ] |
- (*
- File: ErrMgr.mod
-
- Copyright: © 1987-88, 1993-95 by Apple Computer, Inc.
- All rights reserved.
-
- Version: 3.4a4
- Created: Tuesday, March 30, 1993 18:00
-
- *)
-
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE ErrMgr;
-
- IMPORT SYSTEM, Types;
-
-
- PROCEDURE InitErrMgr*(toolErrFilename: Types.Str255;sysErrFilename: Types.Str255;showToolErrNbrs: BOOLEAN);
- EXTERNAL PASCAL;
- (* ErrMgr initialization.This must be done before using any other ErrMgr
- routine. Set showToolErrNbrs to true if you want all tool messages to contain
- the error number following the message text enclosed in parentheses (e.g.,
- "<msg txt> ([OS] Error <n>)"; system error messages always contain the error
- number). The toolErrFileName parameter is used to specify the name of a
- tool-specific error file, and should be the NULL or a null string if not used
- (or if the tool's data fork is to be used as the error file, see
- GetToolErrText for futher details). The sysErrFileName parameter is used to
- specify the name of a system error file, and should normally be the NULL or a
- null string, which causes the ErrMgr to look in the MPW Shell directory for
- "SysErrs.Err" (see GetSysErrText). *)
-
-
- PROCEDURE CloseErrMgr*;
- EXTERNAL (*•• C*);
- (* Ideally a CloseErrMgr should be done at the end of execution to make sure all
- files opened by the ErrMgr are closed. You can let normal program termination
- do the closing. But if you are a purist...
- *)
-
-
- PROCEDURE GetSysErrText*(msgNbr: INTEGER;errMsg: Types.StringPtr);
- EXTERNAL PASCAL;
- (* Get the error message text corresponding to system error number errNbr from
- the system error message file (whose name was specified in the InitErrMgr
- call). The text of the message is returned in errMsg and the function returns
- a pointer to errMsg. The maximum length of the message is limited to 254
- characters.
-
- Note, if a system message filename was not specified to InitErrMgr, then the
- ErrMgr assumes the message file contained in the file "SysErrs.Err". This
- file is first accessed as " (*ShellDirectory*)SysErrs.Err" on the assumption that
- SysErrs.Err is kept in the same directory as the MPW Shell. If the file
- cannot be opened, then an open is attempted on "SysErrs.Err" in the System
- Folder. *)
-
-
- PROCEDURE AddErrInsert*(insert: Types.Str255;msgString: Types.StringPtr);
- EXTERNAL (*•• C*);
- (* Add another insert to an error message string.This call is used when more
- than one insert is to be added to a message (because it contains more than
- one 'POINTER TO ' character).
- *)
-
-
- PROCEDURE GetToolErrText*(msgNbr: INTEGER;errInsert: Types.Str255;errMsg: Types.StringPtr);
- EXTERNAL PASCAL;
- (* Get the error message text corresponding to tool error number errNbr from
- the tool error message file (whose name was specified in the InitErrMgr
- call). The text of the message is returned in errMsg and the function returns
- a pointer to errMsg. The maximum length of the message is limited to 254
- characters. If the message is to have an insert, then ErrInsert should be a
- pointer to it. Otherwise it should be either be a null string or a NULL
- pointer.
-
- Inserts are indicated in error messages by specifying a 'POINTER TO ' to indicate where
- the insert is to be placed.
-
- Note, if a tool message filename was not specified to InitErrMgr, then the
- ErrMgr assumes the message file contained in the data fork of the tool calling
- the ErrMgr. This name is contained in the Shell variable (*Command*) and the
- value of that variable is used to open the error message file. *)
-
-
-
- END ErrMgr.
-
-